home *** CD-ROM | disk | FTP | other *** search
/ Chip: Hang es video / CHIP_ZENESZERKESZTO_2005.ISO / audio_3 / visual / robotfunk / setup.exe / {app} / main.dxr / Internal_165.ls < prev    next >
Encoding:
Text File  |  2003-11-19  |  1.4 KB  |  64 lines

  1. on readini whatfile
  2.   if voidp(whatfile) then
  3.     whatfile = "settings.ini"
  4.   end if
  5.   inistring = readFile(whatfile)
  6.   if voidp(inistring) then
  7.     exit
  8.   end if
  9.   inistring = strip0Achar(inistring)
  10.   wpl = [:]
  11.   numlines = inistring.line.count
  12.   m = 0
  13.   repeat while 1
  14.     m = m + 1
  15.     if m > numlines then
  16.       exit repeat
  17.     end if
  18.     actuallineVal = inistring.line[m]
  19.     if (actuallineVal contains "[") = 1 then
  20.       delete actuallineVal.char[1]
  21.       delete char -30000 of actuallineVal
  22.       newProp = symbol(actuallineVal)
  23.       tmpl = [:]
  24.       repeat while 1
  25.         m = m + 1
  26.         if m > numlines then
  27.           exit repeat
  28.         end if
  29.         actuallineVal = inistring.line[m]
  30.         equalpos = offset("=", actuallineVal)
  31.         if equalpos = 0 then
  32.           exit repeat
  33.           next repeat
  34.         end if
  35.         pr = symbol(actuallineVal.char[1..equalpos - 1])
  36.         vl = actuallineVal.char[equalpos + 1..length(actuallineVal)]
  37.         addProp(tmpl, pr, vl)
  38.       end repeat
  39.       addProp(wpl, newProp, tmpl)
  40.     end if
  41.   end repeat
  42.   return wpl
  43. end
  44.  
  45. on readFile fname
  46.   fObj = new(xtra("FileIO"))
  47.   if objectp(fObj) then
  48.     openFile(fObj, fname, 1)
  49.     thefile = readFile(fObj)
  50.     closeFile(fObj)
  51.     fObj = 0
  52.   end if
  53.   return thefile
  54. end
  55.  
  56. on strip0Achar str
  57.   repeat with m = 1 to the number of lines in str
  58.     if charToNum(str.line[m].char[1]) = 10 then
  59.       delete str.line[m].char[1]
  60.     end if
  61.   end repeat
  62.   return str
  63. end
  64.